

Page({

  /**
   * 页面的初始数据
   */
  data: {
    //0: 订单支付成功页，1:订单申请退款成功页 2:评价成功页 3:收货成功
    pageType: 0,
    navTitle: "详情",
    successText: "支付成功",
    remindText: "您已支付成功，平台会尽快给您安排商品发货!",
    orderNo: null,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    if (options.type) {
      this.setData({
        pageType: options.type
      })
    }
    if (options.type == 0) {
      this.setData({
        orderNo: options.orderNo
      })
    }
    this.setNavTitle()

  },



  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },





  setNavTitle() {
    let navTitle = "支付成功"
    let sucText = "支付成功"
    let remindText = "您已支付成功，平台会尽快给您安排商品发货!"
    switch (parseInt(this.data.pageType)) {
      case 0:
        navTitle = "支付成功"
        sucText = "支付成功"
        remindText = "您已支付成功，平台会尽快给您安排商品发货!"
        break;
      case 1:
        navTitle = "申请成功"
        sucText = "申请成功"
        remindText = "您已申请退款成功，等待平台审核，审核通过后自动退款!"
        break;
      case 2:
        navTitle = "评价成功"
        sucText = "评价成功"
        remindText = "您已评价成功，等待平台审核，审核通过后自动发布!"
        break;
      case 3:
        navTitle = "收货成功"
        sucText = "收货成功"
        remindText = "您已成功收货，如有其它问题可联系客服哦!"
        break;
      default:
        break;
    }
    this.setData({
      successText: sucText,
      remindText: remindText,
    })
    wx.setNavigationBarTitle({
      title: navTitle,
    })
  },
  switchToHome() {
    wx.switchTab({
      url: '/pages/home/home',
    })
  },

  seeOrderDetail() {
    //关闭当前页面跳转到一个新页面
    // wx.redirectTo({
    //   url: '/featurePackage/pages/orderDetail/orderDetail?orderId=' + this.data.orderNo
    // })
    wx.navigateTo({
      url: '/shopMallPackage/pages/myOrderList/myOrderList?type=1',
    })
  },
  pushToPJ() {
    wx.navigateTo({
      url: '/shopMallPackage/pages/myOrderList/myOrderList?type=1',
    })
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})